package ani.trainning.cacobatph.das;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

public class _Entete implements Serializable{




	public static String N_COTISANT = "n_cotisant";
	public static String ANNEE="annee";
	public static String TYPE="type";
	public static String  SOMMESALAIRESANN ="sommeSalairesAnn";
	public static String 	SOMMESALARIESDEC ="sommeSalariesDec";
	public static String IDAGENCE="IdAgence";
	public static String NUMDAS ="numDas";
	public static String TYPEPAYDAS="typePayDas";
	public static String DATERECEP="dateRecep";

	private   String nCotisant;
	private   String annee;
	private   String type;
	private   double sommeSalaireAnn;
	private   int sommeSalairesDec;
	private   String idAgence;
	private   int numDas;
	private   String typePayDas;
	private   String dateRecep;


	public _Entete(String nCotisant, String annee, String type,
			double sommeSalaireAnn, int sommeSalairesDec, String idAgence,
			int numDas, String typePayDas, String dateRecep) {
		super();
		this.nCotisant = nCotisant;
		this.annee = annee;
		this.type = type;
		this.sommeSalaireAnn = sommeSalaireAnn;
		this.sommeSalairesDec = sommeSalairesDec;
		this.idAgence = idAgence;
		this.numDas = numDas;
		this.typePayDas = typePayDas;
		this.dateRecep = dateRecep;
	}
	public _Entete(){}
	public String getnCotisant() {
		return nCotisant;
	}
	public String getAnnee() {
		return annee;
	}
	public String getType() {
		return type;
	}
	public double getSommeSalaireAnn() {
		return sommeSalaireAnn;
	}
	public int getSommeSalairesDec() {
		return sommeSalairesDec;
	}
	public String getIdAgence() {
		return idAgence;
	}
	public int getNumDas() {
		return numDas;
	}
	public String getTypePayDas() {
		return typePayDas;
	}
	public String getDateRecep() {
		return dateRecep;
	}


	public void setnCotisant(String nCotisant) {
		this.nCotisant = nCotisant;
	}
	public void setAnnee(String annee) {
		this.annee = annee;
	}
	public void setType(String type) {
		this.type = type;
	}
	public void setSommeSalaireAnn(double sommeSalaireAnn) {
		this.sommeSalaireAnn = sommeSalaireAnn;
	}
	public void setSommeSalairesDec(int sommeSalairesDec) {
		this.sommeSalairesDec = sommeSalairesDec;
	}
	public void setIdAgence(String idAgence) {
		this.idAgence = idAgence;
	}
	public void setNumDas(int numDas) {
		this.numDas = numDas;
	}
	public void setTypePayDas(String typePayDas) {
		this.typePayDas = typePayDas;
	}
	public void setDateRecep(String dateRecep) {
		this.dateRecep = dateRecep;
	}
	public static _Entete enteteFromJson(String jEntete) throws Exception{

		JSONObject jsonEntite=  new JSONObject(jEntete);
		_Entete entete= new _Entete(jsonEntite
				.getString(N_COTISANT), jsonEntite
				.getString(ANNEE), jsonEntite
				.getString(TYPE), jsonEntite
				.getDouble(SOMMESALAIRESANN), jsonEntite
				.getInt(SOMMESALARIESDEC), jsonEntite
				.getString(IDAGENCE), jsonEntite
				.getInt(NUMDAS), jsonEntite
				.getString(TYPEPAYDAS), jsonEntite
				.getString(DATERECEP));

		return entete;
	}
	public static String enteteToJson(_Entete entete) throws JSONException{

		JSONObject json=new JSONObject();
		json.put(N_COTISANT, entete.getnCotisant());
		json.put(ANNEE,entete.getAnnee());
		json.put(TYPE,entete.getType());
		json.put(SOMMESALAIRESANN,entete.getSommeSalaireAnn());
		json.put(SOMMESALARIESDEC,entete.getSommeSalairesDec());
		json.put(IDAGENCE,entete.getIdAgence());
		json.put(NUMDAS,entete.getNumDas());
		json.put(TYPEPAYDAS,entete.getTypePayDas());
		json.put(DATERECEP,entete.getDateRecep());

		return json.toString();
	}
}
